import React, { useEffect } from 'react';
import { useParams, useNavigate } from 'react-router-dom';
const Index = () => {
    const navigate = useNavigate();
    let params = useParams();
    // useEffect就相当于componentDidMount()生命周期函数
    useEffect(() => {
        console.log(params);
    })
    return (
        <div>
            detail
            <p><button onClick={() => { navigate(-1) }}>回到前一个页面</button></p>
        </div>
    );
}

export default Index;